#include<cstdio>
#include<fstream>
#include<ctime>
using namespace std;

clock_t curT;    //当前帧时间
char tmp[82];
int i=0;
const clock_t interval=16000;    //时间间隔

void   delayto(clock_t time)//time*1000000为秒数 
{
	while (clock() < time);
}

int main()
{
	FILE *fin;
	fin = fopen("frames.txt", "r");	//打开文件
	printf("\033[2J");	//清屏
	curT = clock();
	fgets(tmp, 82, fin);
	while (!feof(fin))
	{
		fgets(tmp, 82, fin);
		if (tmp[0] == '&')	//如果一帧结束了
		{
			if (i == 2)	//帧与帧之间的停顿
			{
				curT = curT + interval;
				i = 0;
			}
			else
			{
				curT = curT + interval + 1000;
				i++;
			}
			delayto(curT);
			printf("\033[0;0H");	//光标回到开头
		}
		else
			printf("%s", tmp);	//扫描一行
	}
	return 0;
}
